﻿using System;
using System.Web.UI;
using EmptyWallGallery.Core;

namespace EmptyWallGallery.FrontEnd.inside.Editor.Gallery
{
    public partial class Album : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindData();

            Page.Title = "Quản lý tác giả - " + Configs.WebTitle;
        }

        public void BindData()
        {
            RptListAlbum.DataSource = Core.BLL.Album.Instance.GetAll();
            RptListAlbum.DataBind();
        }

        protected string WriteAlbumImage(object eval)
        {
            var strImageDefault = eval.ToString() == "" ? "/images/no_image_s.gif" : eval.ToString();
            return "<img src=\"" + strImageDefault + "\" border=\"0\" width=\"130\" height=\"100\" />";
        }

        protected string WriteCreateDate(string toString)
        {
            return DateTime.Parse(toString).AddHours(Configs.TimeLine).ToString("dd-MM-yyyy");
        }

        protected string WriteTotalImage(string albumId)
        {
            return string.Format("{0} tác phẩm", Core.BLL.Images.Instance.GetByAlbum(0, Convert.ToInt32(albumId), true).Count);
        }
    }
}